home *** CD-ROM | disk | FTP | other *** search
/ Adobe Graphics & Publishing SDK 1996 December / Adobe Graphics & Publishing SDK 1996 December.iso / mac / After Effects 3.1 SDK Mac / Examples / Header Files / PI Headers / PIFormat.h next >
Text File  |  1995-01-20  |  10KB  |  261 lines

  1. /*
  2.     File: PIFormat.h
  3.  
  4.     Copyright 1992-1995 by Adobe Systems, Inc..    All rights reserved.
  5.  
  6.     This file describes version 1 of Photoshop's plug-in image format interface.
  7. */
  8.  
  9. #ifndef __PIFormat__
  10. #define __PIFormat__
  11.  
  12. #include "PIGeneral.h"
  13.  
  14. /* Operation selectors */
  15.  
  16. #define formatSelectorAbout              0
  17.  
  18. #define formatSelectorReadPrepare         1
  19. #define formatSelectorReadStart          2
  20. #define formatSelectorReadContinue         3
  21. #define formatSelectorReadFinish         4
  22.  
  23. #define formatSelectorOptionsPrepare     5
  24. #define formatSelectorOptionsStart         6
  25. #define formatSelectorOptionsContinue     7
  26. #define formatSelectorOptionsFinish      8
  27.  
  28. #define formatSelectorEstimatePrepare     9
  29. #define formatSelectorEstimateStart     10
  30. #define formatSelectorEstimateContinue    11
  31. #define formatSelectorEstimateFinish    12
  32.  
  33. #define formatSelectorWritePrepare        13
  34. #define formatSelectorWriteStart        14
  35. #define formatSelectorWriteContinue     15
  36. #define formatSelectorWriteFinish        16
  37.  
  38. #define formatSelectorFilterFile        17
  39.  
  40. /*    We keep various pieces of information about the file format in the PiMI resource.
  41.     Here is the structure of that resource. */
  42.  
  43. /******************************************************************************/
  44.  
  45. #define PIFmtFileTypeProperty   0x666d5443 /* 'fmTC' <TypeCreatorPair> Default file type for file format. */
  46. #define PIReadTypesProperty        0x52645479 /* 'RdTy' <TypeCreatorPair []> File type info for file format plugins */
  47. #define PIWriteTypesProperty    0x57725479 /* 'WrTy' <TypeCreatorPair []> File type info for file format plugins */
  48. #define PIFilteredTypesProperty    0x66667454 /* 'fftT' <TypeCreatorPair []> File types to filter for file format plugins */
  49. #define PIReadExtProperty        0x52644578 /* 'RdEx' <OSType []> File type info for file format plugins */
  50. #define PIWriteExtProperty        0x57724578 /* 'WrEx' <OSType []> File type info for file format plugins */
  51. #define PIFilteredExtProperty    0x66667445 /* 'fftE' <OSType []> File types to filter for file format plugins */
  52. #define PIFmtFlagsProperty        0x666d7466 /* 'fmtf' <Set> Format flags */
  53.  
  54. #define PIFmtMaxSizeProperty    0x6d78737a /* 'mxsz' <Point> Max rows and cols supported by this format. */
  55. #define PIFmtMaxChannelsProperty 0x6d786368 /* 'mxch' <int16 []> Max channels per mode for this format. */
  56.  
  57. /******************************************************************************/
  58.  
  59. /* Format flags indices. */
  60.  
  61. #define PIFmtReadsAllTypesFlag 0
  62. #define PIFmtSavesImageResourcesFlag 1
  63. #define PIFmtCanReadFlag 2
  64. #define PIFmtCanWriteFlag 3
  65. #define PIFmtCanWriteIfReadFlag 4
  66.  
  67. /******************************************************************************/
  68.  
  69. /* Type definitions for format plug-in properties. */
  70.  
  71. /* See comment above on PIFmtModeInfoProperty. */
  72. #if 0
  73.  
  74. #pragma align options=mac68k
  75.  
  76. typedef struct FormatModeInfo
  77.     {
  78.     int16 modeIndex;
  79.     int16 maxRows;
  80.     int16 maxCols;
  81.     int16 maxChannels;
  82.     } FormatModeInfo;
  83.  
  84. #pragma align options=reset
  85.  
  86. #endif
  87.  
  88. /******************************************************************************/
  89.  
  90. /* Pragma to byte align structures; for Borland C */
  91.  
  92. #if defined(__BORLANDC__)
  93. #pragma option -a-
  94. #endif
  95.  
  96. /* Pragma to byte align structures; for Microsoft C */
  97. #if WIN32
  98. #pragma pack(1)
  99. #endif
  100.  
  101. /******************************************************************************/
  102. #if defined(__PPCC__)
  103. #pragma options align=mac68k
  104. #endif
  105.  
  106. typedef struct FormatInfo
  107.     {
  108.  
  109.     PlugInInfo    plugInInfo;             /* The information common to all plug-ins.            */
  110.     int16        typeCount;                /* The number of types in the type list.            */
  111.     int16        extensionCount;         /* The number of extensions in the type list.        */
  112.     Boolean     canRead;                /* Can we read using this format?                    */
  113.     Boolean     readsAllTypes;            /* Can this plug-in read from all files?            */
  114.     Boolean     canWrite;                /* Can we write using this format?                    */
  115.     Boolean        canWriteIfRead;            /* Can we write if we read using this format?         */
  116.     Boolean     savesImageResources;    /* Does this file format save the resource data.    */
  117.     Boolean        padFlag;                /* Padding */
  118.     int16        maxChannels [16];        /* Maximum # of channels with each plug-in mode.    */
  119.     int16        maxRows;                /* Maximum rows allowed in document.                */
  120.     int16        maxCols;                /* Maximum columns allowed in document.             */
  121.     OSType        fileType;                /* The file type if we create a file.                */
  122.     OSType        creatorType;            /* The creator type if we create a file.            */
  123.     OSType        typeList [1];            /* The types and extensions supported.                */
  124.  
  125.     }
  126. FormatInfo;
  127.  
  128. /******************************************************************************/
  129. /* turn off the byte align pragma back to its original state; only for Borland C */
  130. #if defined(__BORLANDC__)
  131. #pragma option -a.
  132. #endif
  133.  
  134. /* Pragma to turn off align structures for Microsoft C */
  135. #if WIN32
  136. #pragma pack()
  137. #endif
  138. /******************************************************************************/
  139.  
  140. /*    Error return values. The plug-in module may also return standard Macintosh
  141.     operating system error codes, or report its own errors, in which case it
  142.     can return any positive integer. */
  143.  
  144. #define formatBadParameters -30500
  145. #define formatCannotRead    -30501
  146.  
  147. typedef struct FormatRecord
  148.     {
  149.  
  150.     int32                serialNumber;    /* Host's serial number, to allow
  151.                                            copy protected plug-in modules. */
  152.  
  153.     TestAbortProc        abortProc;        /* The plug-in module may call this no-argument
  154.                                            BOOLEAN function (using Pascal calling
  155.                                            conventions) several times a second during long
  156.                                            operations to allow the user to abort the operation.
  157.                                            If it returns TRUE, the operation should be aborted
  158.                                            (and a positive error code returned). */
  159.  
  160.     ProgressProc        progressProc;    /* The plug-in module may call this two-argument
  161.                                            procedure periodically to update a progress
  162.                                            indicator.  The first parameter is the number
  163.                                            of operations completed; the second is the total
  164.                                            number of operations. */
  165.  
  166.     int32                maxData;        /* Maximum number of bytes that should be
  167.                                            passed back at once, plus the size of any
  168.                                            interal buffers. The plug-in may reduce this
  169.                                            value in the formatSelectorPrepare routine. */
  170.  
  171.     int32                minDataBytes;    /* Disk space needed for the data fork. */
  172.     int32                maxDataBytes;    /* Disk space needed for the data fork. */
  173.  
  174.     int32                minRsrcBytes;    /* Disk space needed for the resource fork. */
  175.     int32                maxRsrcBytes;    /* Disk space needed for the resource fork. */
  176.  
  177.     int32                dataFork;        /* refnum for the data fork. */
  178.     int32                rsrcFork;        /* refnum for the resource fork. */
  179.     
  180.     FSSpec *            fileSpec;        /* Full file specification. */
  181.  
  182.     int16                imageMode;        /* Image mode */
  183.     Point                imageSize;        /* Size of image */
  184.     int16                depth;            /* Bits per sample, currently must be 1 or 8 */
  185.     int16                planes;         /* Samples per pixel */
  186.  
  187.     Fixed                imageHRes;        /* Pixels per inch */
  188.     Fixed                imageVRes;        /* Pixels per inch */
  189.  
  190.     LookUpTable            redLUT;         /* Red LUT, only used for Indexed Color images */
  191.     LookUpTable            greenLUT;        /* Green LUT, only used for Indexed Color images */
  192.     LookUpTable            blueLUT;        /* Blue LUT, only used for Indexed Color images */
  193.  
  194.     void *                data;            /* A pointer to the returned image data. The
  195.                                            plug-in module is responsible for freeing
  196.                                            this buffer. Should be set to NIL when
  197.                                            all the image data has been returned. */
  198.  
  199.     Rect                theRect;        /* Rectangle being returned */
  200.     int16                loPlane;        /* First plane being returned */
  201.     int16                hiPlane;        /* Last plane being returned */
  202.     int16                colBytes;        /* Spacing between columns */
  203.     int32                rowBytes;        /* Spacing between rows */
  204.     int32                planeBytes;     /* Spacing between planes (ignored if only one
  205.                                            plane is returned at a time) */
  206.     PlaneMap            planeMap;        /* Maps plug-in plane numbers to host plane
  207.                                            numbers.  The host initializes this is a linear
  208.                                            mapping.  The plug-in may change this mapping if
  209.                                            it sees the data in a different order. */
  210.  
  211.     Boolean             canTranspose;    /* Is the host able to transpose the image? */
  212.     Boolean             needTranspose;    /* Does the plug-in need the image transposed? */
  213.  
  214.     OSType                hostSig;        /* Creator code for host application */
  215.     HostProc            hostProc;        /* Host specific callback procedure */
  216.  
  217.     int16                hostModes;        /* Used by the host to inform the plug-in which
  218.                                            imageMode values it supports.  If the corresponding
  219.                                            bit (LSB = bit 0) is 1, the mode is supported. */
  220.  
  221.     Handle                revertInfo;     /* Information to be kept with the document for reverting or
  222.                                            saving.    Where possible this handle should be used to
  223.                                            avoid bringing up an options dialog. */
  224.  
  225.     NewPIHandleProc        hostNewHdl;     /* Handle allocation and disposal for revert info. */
  226.     DisposePIHandleProc    hostDisposeHdl;
  227.     
  228.     Handle                imageRsrcData;    /* Handle containing the block of resource data. */
  229.     int32                imageRsrcSize;    /* size of image resources. */
  230.  
  231.     PlugInMonitor        monitor;        /* The host's monitor. */
  232.  
  233.     void *                platformData;    /* Platform specific information. */
  234.  
  235.     BufferProcs *        bufferProcs;    /* The procedures for allocating and */
  236.                                         /* releasing buffers. */
  237.                                         
  238.     ResourceProcs *        resourceProcs;    /* Plug-in resource procedures. */
  239.  
  240.     ProcessEventProc    processEvent;    /* Pass event to the application. */
  241.     
  242.     DisplayPixelsProc    displayPixels;    /* Display dithered pixels. */
  243.  
  244.     HandleProcs            *handleProcs;    /* Platform independent handle manipulation. */
  245.     
  246.     OSType                fileType;        /* File-type for filtering */
  247.  
  248.     ColorServicesProc    colorServices; /* Routine to access color services. */
  249.     
  250.     AdvanceStateProc    advanceState;    /* Valid from continue selectors. */
  251.  
  252.     char                reserved [236]; /* Set to zero */
  253.  
  254.     }
  255. FormatRecord, *FormatRecordPtr;
  256. #if defined(__PPCC__)
  257. #pragma options align=reset
  258. #endif
  259. /******************************************************************************/
  260. #endif
  261.